﻿@{
    ViewBag.Title = "LiveBillForm";
    Layout = "~/Views/Shared/_FlowForm.cshtml";
}@using LeSoft.Application.Code;
<script src="~/Content/scripts/jquery/layer/jquery.js?v=1.83.min"></script>
<script src="~/Content/scripts/jquery/layer/layer.min.js"></script>
<link href="~/Content/styles/font-awesome.min.css" rel="stylesheet" />
<link href="~/Content/styles/BillDetail.css?v=1.1" rel="stylesheet" />
<link href="~/Content/styles/anitmate.css" rel="stylesheet" />
<link href="~/Content/styles/style.css" rel="stylesheet" />
<link href="~/Content/scripts/plugins/tree/tree.css" rel="stylesheet" />
<link href="~/Content/scripts/plugins/jqgrid/jqgrid.css" rel="stylesheet" />
<script src="~/Content/scripts/plugins/tree/tree.js"></script>
<script src="/Content/scripts/plugins/validator/js?v=XgpF3bkqcHESsLip2j1dhS6n2I-zHyD2VCazpanqH6Q1"></script>
<script src="/Content/scripts/utils/js?v=FNqaC7G7A87_J4VCIQpQEAO-d_2Qf2wSxoZexwRzulo1"></script>
<script src="~/Content/scripts/plugins/jqgrid/jqgrid.js"></script>
<script src="~/Content/scripts/jquery/ajaxfileupload.js"></script>
<script src="~/Content/scripts/utils/LeSoft-ui.js"></script>
<script>
    var keyValue = request('keyValue');
    var billDetailId = "";
    var organizeid = "";
    var sourceType = 1, sourceId = "", fileFilter = [];
    var DeviceId = "";
    var State = 0;
    var OperateMemo;
    var RoomData = [];
    $(function () {
        initControl();
        GetFXLBGrid("");
        GetYSFYGrid("");
        GetAuditGrid("");
    });

    function initControl() {

        $("#OrganizeId").ComboBoxTree({
            url: "../../BaseManage/Organize/GetTreeJson",
            description: "==请选择所属机构==",
            height: "250px",
            click: function (data) {
                organizeid = data.id;
            }
        });
        if (!!keyValue) {
            $.SetForm({
                url: "../../ResourceManage/RS_PStructUser/GetLiveInBillInfo",
                param: { keyValue: keyValue },
                success: function (data) {
                    ShowBtn(data.BillInfo.State);
                    State = data.BillInfo.State;
                    $("#BillInfo").SetWebControls(data.BillInfo);
                    $("#CusteomerInfo").SetWebControls(data.CusteomerInfo);
                    getRoomGrid(data.Roomlist);
                    RoomData = data.Roomlist;
                    //getOperateGrid(data.BillInfo.OperateMemo);
                    GetRoomDetailGrid(data.ProductListMemo)
                    GetRoomMeterGrid(data.EnergyMeter);
                    $("#PSMemo").val(data.PSMemo);
                    GetAuditGrid(data.AuditList);
                }

            });
        }


    }

    //房间列表
    function getRoomGrid(data) {
        $gridTable = $("#gridTable_room");
        $gridTable.jqGrid({
            datatype: "json",
            autowidth: true,
            height: 240,
            colModel: [
                { label: "主键", name: "id", hidden: true },
                { label: "房产主键", name: "psid", hidden: true },
                { label: "房间主键", name: "roomid", hidden: true },
                { label: "房屋名称", name: "name", index: "name", width: 300, align: "center", sortable: false },
                { label: "房屋编号", name: "code", index: "code", width: 200, align: "center", sortable: false },
                { label: "建筑面积", name: "area", index: "area", width: 115, align: "center", sortable: false },
                { label: "附加说明", name: "memo", index: "memo", width: 300, align: "center", sortable: false },
            ],
            viewrecords: true,
            rowNum: 30,
            rownumbers: true,
            gridview: true,
            hidegrid: false,
        });
        $gridTable[0].addJSONData(data);

    }
    //设施列表
    function GetRoomDetailGrid(data) {
        $gridTable = $("#gridTable_RoomDetail");
        $gridTable.jqGrid({
            datatype: "json",
            autowidth: true,
            unwritten: false,
            height: 190,
            caption: "设施列表",
            colModel: [
                { label: "主键", name: "Id", hidden: true },
                { label: "房间ID", name: "RoomId", index: "RoomId", width: 100, align: "center", sortable: false, hidden: true },
                {
                    label: "房间", name: "RoomName", index: "RoomName", width: 200, align: "center", sortable: false,
                    formatter: function (cellvalue, options, rowObject) {
                        for (var i = 0; i < RoomData.length; i++) {
                            if (RoomData[i]["roomid"] == rowObject.RoomId) {
                                return RoomData[i]["name"];
                            }
                        }
                        return cellvalue;
                    }
                },
                { label: "类别", name: "ModelNo", index: "ModelNo", width: 100, align: "center", sortable: false },
                { label: "设施名称", name: "Name", index: "Name", width: 200, align: "center", sortable: false },
                { label: "设施编号", name: "Code", index: "Code", width: 100, align: "center", sortable: false },
                { label: "数量", name: "Num", index: "Num", width: 100, align: "center", sortable: false },
                { label: "备注", name: "PSMemo", index: "PSMemo", width: 250, align: "center", sortable: false },
            ],
            viewrecords: true,
            rowNum: 30,
            rownumbers: true,
            gridview: true,
            hidegrid: false,
        });
        $gridTable[0].addJSONData(JSON.parse("[" + data + "]"));

    }
    //费表列表
    function GetRoomMeterGrid(data) {
        $gridTable = $("#gridTable_RoomMeter");
        $gridTable.jqGrid({
            datatype: "json",
            autowidth: true,
            caption: "费表列表",
            unwritten: false,
            height: 190,
            colModel: [
                { label: "主键", name: "Id", hidden: true },
                { label: "主键", name: "PStructId", hidden: true },
                { label: "房间名称", name: "CreateUserName", index: "CreateUserName", width: 200, align: "center", sortable: false },
                { label: "表名称", name: "Name", index: "Name", width: 100, align: "center", sortable: false },
                { label: "表编号", name: "Code", index: "Code", width: 100, align: "center", sortable: false },
                { label: "倍率", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "量程", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "单价", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "当前", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "备注", name: "Description", index: "Description", width: 150, align: "center", sortable: false },
            ],
            viewrecords: true,
            rowNum: 30,
            rownumbers: true,
            gridview: true,
            hidegrid: false,
        });
        $gridTable[0].addJSONData(data);

    }
    //周期费项列表
    function GetFXLBGrid(data) {
        $gridTable = $("#gridTable_FXLB");
        $gridTable.jqGrid({
            datatype: "json",
            autowidth: true,
            hidegrid: false,
            unwritten: false,
            height: 250,
            caption: "周期费项列表",
            colModel: [
                { label: "主键", name: "Id", hidden: true },
                { label: "房间名称", name: "Address", index: "Address", width: 200, align: "center", sortable: false },
                { label: "费项名称", name: "Area", index: "Area", width: 100, align: "center", sortable: false },
                { label: "用量公式", name: "Owner", index: "Owner", width: 100, align: "center", sortable: false },
                { label: "单价", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "计费周期", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "计费起始日期", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "计费终止日期", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "备注", name: "PeopleCount", index: "PeopleCount", width: 150, align: "center", sortable: false },
            ],
            viewrecords: true,
            rowNum: 30,
            rownumbers: true,
            gridview: true,
        });
        $gridTable[0].addJSONData(data);

    }
    // 入住应收列表
    function GetYSFYGrid(data) {
        $gridTable = $("#gridTable_YSFY");
        $gridTable.jqGrid({
            datatype: "json",
            autowidth: true,
            hidegrid: false,
            height: 250,
            caption: "入住应收列表",
            colModel: [
                { label: "主键", name: "Id", hidden: true },
                { label: "费项名称", name: "Address", index: "Address", width: 100, align: "center", sortable: false },
                { label: "应收期间", name: "Area", index: "Area", width: 100, align: "center", sortable: false },
                { label: "计费周期", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "计费起始日期", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "计费终止日期", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "单价", name: "PeopleCount", index: "PeopleCount", width: 60, align: "center", sortable: false },
                { label: "应收金额", name: "PeopleCount", index: "PeopleCount", width: 90, align: "center", sortable: false },
                { label: "已收金额", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "未收金额", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
                { label: "备注", name: "PeopleCount", index: "PeopleCount", width: 100, align: "center", sortable: false },
            ],
            viewrecords: true,
            rowNum: 30,
            rownumbers: true,
            gridview: true,
        });
        $gridTable[0].addJSONData(data);

    }
    //操作记录
    function getOperateGrid() {
        $gridTable = $("#gridTable_Operate");
        $gridTable.jqGrid({
            url: "../../SystemManage/Setting/GetOperateRecordList",
            postData: { BillId: keyValue },
            datatype: "json",
            height: 650,
            hidegrid: false,
            caption: "操作记录",
            autowidth: true,
            colModel: [
               { label: '项目主键', name: 'Id', hidden: true },
                        { label: '业务类别', name: 'Type', width: 100, align: 'center', sortable: false },
                        { label: '操作人', name: 'FromOperateName', width: 100, align: 'center', sortable: false },
                        { label: '操作时间', name: 'Date', width: 170, align: 'center', sortable: false },
                        {
                            label: "操作内容", name: "Content", index: "Content", width: 590, align: "left", sortable: false,
                            formatter: function (cellvalue, options, rowObject) {
                                if (!!rowObject.ToOperateName)
                                    return "发起者：" + rowObject.FromOperateName + "，接受者：" + rowObject.ToOperateName + "<br/>" + cellvalue;
                                else
                                    return "发起者：" + rowObject.FromOperateName + "<br/>" + cellvalue;
                            }
                        },
            ],
            viewrecords: true,
            rownumbers: true,

        });
    //审核记录
    function GetAuditGrid(data) {
        var $gridTable = $("#gridTable_Audit");
        $gridTable.jqGrid({
            datatype: "json",
            height: 100,
            autowidth: true,
            unwritten: false,
            colModel: [
              { label: "主键", name: "Id", hidden: true },
              { label: "审核人", name: "AuditMan", index: "AuditMan", width: 200, align: "center", sortable: false },
              { label: "审核时间", name: "AuditTime", index: "AuditTime", width: 200, align: "center", sortable: false },
              {
                  label: "审核结果", name: "AuditState", index: "AuditState", width: 200, align: "center", sortable: false,
                  formatter: function (cellvalue, options, rowObject) {
                      if (cellvalue == 1) {
                          return "同意";
                      }
                      if (cellvalue == 2) {
                          return "不同意";
                      }
                      return cellvalue;
                  }
              },
              { label: "审核说明", name: "AuditMemo", index: "AuditMemo", width: 380, align: "center", sortable: false },
            ],
            viewrecords: true,
            rowNum: 30,
            gridview: true,
        });
        $gridTable[0].addJSONData(data);

    }
    //房间物品添加
    function btn_AddRoomDetail() {
        var BillId = keyValue;
        dialogOpen({
            id: "RoomDetail",
            title: '添加房间物品',
            url: '../../ResourceManage/RS_PStructUser/RoomDetail?BillId=' + BillId,
            width: "500px",
            height: "400px",
            callBack: function (iframeId) {
                top.frames[iframeId].AcceptClick();
            },
        });
    }
    //房间物品删除
    function btn_DelRoomDetail() {
        var keyValue = $("#gridTable_RoomDetail").getGridParam('selrow');
        if (keyValue) {
            dialogConfirm('注：您确定要移除吗？该操作将无法恢复？', function (r) {
                if (r) {
                    $("#gridTable_RoomDetail").delRowData(keyValue);
                    dialogMsg("移除成功。", 1);
                }
            });

        } else {
            dialogMsg('请选择需要移除的数据！', 0);
        }
    }
    //费表添加
    function btn_AddMeter() {
        var BillId = keyValue;
        dialogOpen({
            id: "RoomMeter",
            title: '添加房间费表',
            url: '../../ResourceManage/RS_PStructUser/RoomMeter?BillId=' + BillId,
            width: "800px",
            height: "500px",
            callBack: function (iframeId) {
                top.frames[iframeId].AcceptClick();
            },
        });
    }
    //费表物品删除
    function btn_DelMeter() {
        var keyValue = $("#gridTable_RoomMeter").getGridParam('selrow');
        if (keyValue) {
            dialogConfirm('注：您确定要移除吗？该操作将无法恢复？', function (r) {
                if (r) {
                    $("#gridTable_RoomMeter").delRowData(keyValue);
                    dialogMsg("移除成功。", 1);
                }
            });

        } else {
            dialogMsg('请选择需要移除的数据！', 0);
        }
    }
    //列表查看详情
    function btn_Open(s) {
        if (s == 1) {//房间物品
            var key = $("#gridTable_RoomDetail").getGridParam('selrow');
            var BillId = keyValue;
            if (checkedRow(key)) {
                dialogOpen({
                    id: "RoomDetailList",
                    title: '房间物品信息',
                    url: '../../ResourceManage/RS_PStructUser/RoomDetail?keyValue=' + key + '&BillId=' + BillId,
                    width: "500px",
                    height: "350px",
                    callBack: function (iframeId) {
                        top.frames[iframeId].AcceptClick();
                    },
                    btn: null
                });
            }
        }
        if (s == 2) {//费表
            var BillId = keyValue;
            var key = $("#gridTable_RoomMeter").getGridParam('selrow');
            if (checkedRow(key)) {
                dialogOpen({
                    id: "Form",
                    title: '费表资料',
                    url: '/ResourceManage/RS_PStructUser/RoomMeter?keyValue=' + key + '&BillId=' + BillId,
                    width: "800px",
                    height: "500px",
                    callBack: function (iframeId) {
                        top.frames[iframeId].AcceptClick();
                    },
                    btn: null
                })

            }

        }
        if (s == 3) {//周期费用

        }
        if (s == 4) { //入住应收

        }
    }

    //提交
    function btn_Submit() {
        if (!$('#BillInfo').Validform()) {
            return false;
        }
        debugger;
        var queryJson = $("#BillInfo").GetWebControls(keyValue);
        $.ConfirmAjax({
            msg: "注：确认要提交吗？提交后无法更改！",
            url: "../../ResourceManage/RS_PStructUser/SubmintLiveBill?keyValue=" + keyValue,
            param: { queryJson: JSON.stringify(queryJson) },
            loading: "正在保存数据...",
            success: function () {
                $.currentIframe().$("#gridTable").resetSelection();
                $.currentIframe().$("#gridTable").trigger("reloadGrid");
                dialogClose();
            }
        });

    }
    //审核
    function btn_Audit(R) {
        var AuditMmemo = "";
        var RoomDetailList = $("#gridTable_RoomDetail").jqGrid("getRowData");
        var RoomMeterList = $("#gridTable_RoomMeter").jqGrid("getRowData");
        var Msg = "确认要提交吗？";
        if (RoomDetailList.length == 0) {
            Msg = "注：设施列表为空，确认要提交吗？";
        }
        if (RoomMeterList.length == 0) {
            Msg = "注：费表列表为空，确认要提交吗？";
        }
        if (RoomDetailList.length == 0 && RoomMeterList.length == 0) {
            Msg = "注：设施列表和费表列表为空，确认要提交吗？";
        }
        AuditMemo = $.trim($("#AuditMemo").val());
        if (R == 0 && AuditMemo === "") {
            dialogMsg('不同意需说明不同意原因！', 0);
            return false;
        }
        $.ConfirmAjax({
            msg: Msg,
            url: "../../ResourceManage/RS_PStructUser/AuditLiveBill?keyValue=" + keyValue + "&Result=" + R,
            param: { RoomDetailList: JSON.stringify(RoomDetailList), RoomMeterList: JSON.stringify(RoomMeterList), AuditMemo: AuditMemo },
            loading: "正在保存数据...",
            success: function () {
                $.currentIframe().$("#gridTable").resetSelection();
                $.currentIframe().$("#gridTable").trigger("reloadGrid");
            }
        });
    }
    //确认入住
    function btn_Live() {
        $.ConfirmAjax({
            msg: "注：确认要提交吗？提交后无法更改！",
            url: "../../ResourceManage/RS_PStructUser/LiveForm?keyValue=" + keyValue,
            loading: "正在保存数据...",
            success: function () {
                $.currentIframe().$("#gridTable").resetSelection();
                $.currentIframe().$("#gridTable").trigger("reloadGrid");
                dialogClose();
            }
        });
    }
    //关闭
    function btn_Close() {
        dialogClose();
    }

    function ShowBtn(State) {
        switch (State) {
            case 1:
                $(".audit").attr("hidden", "hidden")
                $(".Audit").attr("hidden", "hidden")
                $(".Live").attr("hidden", "hidden");
                $(".Submit").removeAttr("hidden");

                break;
            case 2:
                $('.pay').click();
                $(".Submit").attr("hidden", "hidden")
                $(".Live").attr("hidden", "hidden");
                $(".audit").removeAttr("hidden");
                $(".Audit").removeAttr("hidden");
                $(".BaseClass").attr("disabled", "disabled")
                break;
            case 3:
                $('.pay').click();
                $(".Submit").attr("hidden", "hidden");
                $(".audit").removeAttr("hidden");
                $(".Audit").attr("hidden", "hidden");
                $(".auditmemo").attr("hidden", "hidden");
                $(".Live").removeAttr("hidden");
                $(".BaseClass").attr("disabled", "disabled")
                break;
            default:
                $(".Submit").removeAttr("hidden");
                $(".toolbar a").attr("disabled", "disabled");
                $(".audit").removeAttr("hidden");
                $("#btn_Submit").attr("disabled", "disabled")
                $(".complete").attr("hidden", "hidden");
                $(".Live").attr("hidden", "hidden");
                $(".auditmemo").attr("hidden", "hidden");
                $(".Audit").attr("hidden", "hidden");
                $(".BaseClass").attr("disabled", "disabled")
                break;

        }

    }

</script>
<div id="wrapper" style="background:#fff;">
    <div id="left-side" style="margin-top:5px;">
        <ul>
            <li class="choose active">
                基础信息
            </li>
            <li class="pay">
                设施设备
            </li>
            <li class="wrap">
                费项应收
            </li>
            <li class="Operate">
                操作记录
            </li>
        </ul>
    </div>
    <div id="border">
        <div id="line" class="one"></div>
    </div>
    <div id="right-side" class="tab-content" style="width:100%;">
        <div id="first" class="tab-pane active">
            <div class="tab-content">
                <table class="form " id="BillInfo" style="width: 95%; ">
                    <tr>
                        <td class="formTitle">所属机构<font face="宋体">*</font></td>
                        <td class="formValue">
                            <div id="OrganizeId" type="selectTree" class="ui-select BaseClass" isvalid="yes" checkexpession="NotNull"></div>
                        </td>
                        <th class="formTitle">单据编号<font face="宋体">*</font></th>
                        <td class="formValue">
                            <input id="State" type="hidden" />
                            <input id="Code" type="text" readonly class="form-control BaseClass" isvalid="yes" checkexpession="NotNull" />
                        </td>
                        <th class="formTitle">单据日期<font face="宋体">*</font></th>
                        <td class="formValue">
                            <input id="CreateDate" type="text" class="form-control input-wdatepicker BaseClass" isvalid="yes" checkexpession="NotNull" placeholder="请输入单据日期" value="@LeSoft.Util.Time.GetToday("yyyy-MM-dd")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">入住日期<font face="宋体">*</font></th>
                        <td class="formValue">
                            <input id="BeginDate" type="text" class="form-control input-wdatepicker BaseClass" isvalid="yes" checkexpession="NotNull" placeholder="请输入入住日期" value="@LeSoft.Util.Time.GetToday("yyyy-MM-dd")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" />
                        </td>
                        <th class="formTitle">退住日期<font face="宋体">*</font></th>
                        <td class="formValue">
                            <input id="EndDate" type="text" class="form-control input-wdatepicker BaseClass" isvalid="yes" checkexpession="NotNull" placeholder="请输入退住日期" value="@LeSoft.Util.Time.GetToday("yyyy-MM-dd")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">附加说明</th>
                        <td class="formValue" colspan="5">
                            <textarea id="Description" class="form-control BaseClass" style="height: 50px;"></textarea>
                        </td>
                    </tr>
                    <tr style="height:15px;"><td colspan="6" style="border-bottom:1px #ccc dashed;"></td> </tr>
                    <tr style="height:15px;"><td></td></tr>
                </table>
                <table class="form" id="ContractInfo" style="width: 95%; ">
                    <tr>
                        <th class="formTitle">合同编号</th>
                        <td class="formValue">
                            <input id="Code" type="text" readonly placeholder="合同编号" class="form-control " />
                        </td>
                        <th class="formTitle">合同起始日期</th>
                        <td class="formValue">
                            <input id="Date" type="text" readonly class="form-control input-wdatepicker BaseClass" placeholder="请输入入住日期" value="@LeSoft.Util.Time.GetToday("yyyy-MM-dd")" />
                        </td>
                        <th class="formTitle">合同终止日期</th>
                        <td class="formValue">
                            <input id="Date" type="text" readonly class="form-control input-wdatepicker BaseClass" placeholder="请输入退住日期" value="@LeSoft.Util.Time.GetToday("yyyy-MM-dd")" />
                        </td>
                    </tr>
                    <tr>

                        <th class="formTitle">交房日期</th>
                        <td class="formValue">
                            <input id="Date" type="text" readonly class="form-control input-wdatepicker BaseClass" placeholder="请输入入住日期" value="@LeSoft.Util.Time.GetToday("yyyy-MM-dd")" />
                        </td>
                        <th class="formTitle">装修起始日期</th>
                        <td class="formValue">
                            <input id="Date" type="text" readonly class="form-control input-wdatepicker BaseClass" placeholder="请输入入住日期" value="@LeSoft.Util.Time.GetToday("yyyy-MM-dd")" />
                        </td>
                        <th class="formTitle">装修终止日期</th>
                        <td class="formValue">
                            <input id="Date" type="text" readonly class="form-control input-wdatepicker BaseClass" placeholder="请输入退住日期" value="@LeSoft.Util.Time.GetToday("yyyy-MM-dd")" />
                        </td>
                    </tr>
                    <tr style="height:15px;"><td colspan="6" style="border-bottom:1px #ccc dashed;"></td> </tr>
                    <tr style="height:15px;"><td></td></tr>

                </table>
                <table class="form" id="CusteomerInfo" style="width: 95%; ">
                    <tr>
                        <th class="formTitle">租户名称</th>
                        <td class="formValue">
                            <input id="Name" type="text" readonly class="form-control BaseClass" />
                        </td>
                        <th class="formTitle">租户编号</th>
                        <td class="formValue">
                            <input id="Code" type="text" readonly class="form-control BaseClass" />
                        </td>
                        <th class="formTitle">租户简称</th>
                        <td class="formValue">
                            <input id="ShortName" type="text" readonly class="form-control BaseClass" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">联系人</th>
                        <td class="formValue">
                            <input id="LinkMan" type="text" readonly class="form-control BaseClass" />
                        </td>
                        <th class="formTitle">手机号码</th>
                        <td class="formValue">
                            <input id="PhoneNum" type="text" readonly class="form-control BaseClass " />
                        </td>
                        <th class="formTitle">联系电话</th>
                        <td class="formValue">
                            <input id="LinkPhoneNum" type="text" readonly class="form-control BaseClass" />
                        </td>

                    </tr>
                    <tr style="height:15px;"><td colspan="6" style="border-bottom:1px #ccc dashed;"></td> </tr>
                    <tr style="height:15px;"><td></td></tr>
                    <tr>
                        <td colspan="6">
                            <div class="gridPanel">
                                <table id="gridTable_room"></table>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">房产描述</th>
                        <td class="formValue" colspan="5">
                            <input id="PSMemo" type="text" readonly class="form-control BaseClass" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div id="second" class="tab-pane" style="max-height: 762px;overflow-y: scroll;">
            <table class="form" id="Repairform1" style="width:99%;">
                <tr>
                    <td colspan="9">
                        <div class="gridPanel">
                            <table id="gridTable_RoomDetail"></table>
                        </div>
                    </td>
                </tr>
                <tr style="height:5px;"><td colspan="9" style=" border-bottom:1px  dashed #ccc;"></td> </tr>
                <tr style="height:5px; "> </tr>
                <tr>
                    <td colspan="9">
                        <div class="gridPanel">
                            <table id="gridTable_RoomMeter"></table>
                        </div>
                    </td>
                </tr>
                <tr style="height:5px;"><td colspan="9" style=" border-bottom:1px  dashed #ccc;"></td> </tr>
                <tr style="height:5px; "> </tr>
                <tr class="audit">
                    <td colspan="9">
                        <div class="gridPanel">
                            <table id="gridTable_Audit"></table>
                        </div>
                    </td>
                </tr>
                <tr class="audit auditmemo">
                    <th class="formTitle">审核意见</th>
                    <td class="formValue" colspan="8">
                        <textarea id="AuditMemo" class="form-control" style="height: 40px;"></textarea>
                    </td>
                </tr>
            </table>
        </div>
        <div id="third" class="tab-pane" style="max-height: 762px;overflow-y: scroll;">
            <table class="form" id="Repairform1">
                <tr>
                    <td>
                        <div class="gridPanel">
                            <table id="gridTable_FXLB"></table>
                        </div>
                    </td>
                </tr>
                <tr style="height:32px;"><td><hr style="background-color: #cecece; height: 1px;" /></td> </tr>
                <tr>
                    <td>
                        <div class="gridPanel">
                            <table id="gridTable_YSFY"></table>
                        </div>
                    </td>
                </tr>

            </table>
        </div>
        <div id="fourth" class="tab-pane" style="max-height: 762px;overflow-y: scroll;">
            <table class="form" id="Repairform1">
                <tr>
                    <td>
                        <div class="gridPanel">
                            <table id="gridTable_Operate"></table>
                        </div>
                    </td>
                </tr>

            </table>
        </div>
    </div>
    <script>
        var State = $("#State").val();
        $('.choose').click(function () {
            $(".CS_SS").attr("hidden", "hidden");
            $(".CS_FX").attr("hidden", "hidden");
            $('.choose').addClass('active');
            $('.pay').removeClass('active');
            $('.wrap').removeClass('active');
            $('.ship').removeClass('active');
            $('#line').addClass('one');
            $('#line').removeClass('two');
            $('#line').removeClass('three');
            $('#line').removeClass('four');
            $('#first').addClass('active');
            $('#second').removeClass('active');
            $('#third').removeClass('active');
            $('#fourth').removeClass('active');
            $("#right-side table").css("margin", "0px");

        });
        $('.pay').click(function () {
            if (State == 1) {
                return false;
            }
            $(".CS_SS").removeAttr("hidden");
            $(".CS_FX").attr("hidden", "hidden");
            $('.pay').addClass('active');
            $('.choose').removeClass('active');
            $('.wrap').removeClass('active');
            $('.ship').removeClass('active');
            $('#line').addClass('two');
            $('#line').removeClass('one');
            $('#line').removeClass('three');
            $('#line').removeClass('four');
            $('#first').removeClass('active');
            $('#second').addClass('active');
            $('#third').removeClass('active');
            $('#fourth').removeClass('active');
            $("#right-side table").css("margin", "0px");
        });
        $('.wrap').click(function () {
            if (State == 1 || State == 2) {
                return false;
            }
            $(".CS_SS").attr("hidden", "hidden");
            $(".CS_FX").removeAttr("hidden");
            $('.wrap').addClass('active');
            $('.pay').removeClass('active');
            $('.choose').removeClass('active');
            $('.ship').removeClass('active');
            $('#line').addClass('three');
            $('#line').removeClass('two');
            $('#line').removeClass('one');
            $('#line').removeClass('four');
            $('#first').removeClass('active');
            $('#second').removeClass('active');
            $('#third').addClass('active');
            $('#fourth').removeClass('active');
            $("#right-side table").css("margin", "0px");
        });
        $('.Operate').click(function () {
            $(".CS_SS").attr("hidden", "hidden");
            $(".CS_FX").attr("hidden", "hidden");
            $('.fourth').addClass('active');
            $('.pay').removeClass('active');
            $('.choose').removeClass('active');
            $('.wrap').removeClass('active');
            $('#line').addClass('four');
            $('#fourth').addClass('active');
            $('#line').removeClass('two');
            $('#line').removeClass('one');
            $('#line').removeClass('three');
            $('#first').removeClass('active');
            $('#second').removeClass('active');
            $('#third').removeClass('active');
            $("#right-side table").css("margin", "0px");
            getOperateGrid();
        });
    </script>

</div>
<div class="form-button Submit" id="wizard-actions">
    <a id="btn_Submit" onclick="btn_Submit();" class="btn btn-info ">提交</a>
    <a id="btn_Close" onclick="btn_Close();" class="btn btn-danger ">关闭</a>
</div>
<div class="form-button Audit" id="wizard-actions">
    <a id="btn_Audit" onclick="btn_Audit(1);" class="btn btn-success ">同意</a>
    <a id="btn_Audit" onclick="btn_Audit(0);" class="btn btn-info ">不同意</a>
    <a id="btn_Close" onclick="btn_Close();" class="btn btn-danger ">关闭</a>
</div>
<div class="form-button Live" id="wizard-actions">
    <a id="btn_Live" onclick="btn_Live();" class="btn btn-success ">确定入住</a>
    <a id="btn_Close" onclick="btn_Close();" class="btn btn-danger ">关闭</a>
</div>
<div class="toolbar CS_SS" style="position: absolute; top: 5px; right: 30px;" hidden>
    <a id="btn_AddRoomDetail" class="btn btn-default btn-xs " onclick="btn_AddRoomDetail()"><i class="fa fa-plus "></i>&nbsp;添加</a>
    <a id="btn_Open1" onclick="btn_Open(1);" class="btn btn-default btn-xs "><i class="fa fa-eye "></i>&nbsp;查看</a>
    <a id="btn_DelRoomDetail" class="btn btn-default btn-xs " onclick="btn_DelRoomDetail()"><i class="fa fa-trash-o "></i>&nbsp;移除</a>
</div>
<div class="toolbar CS_SS" style="position: absolute; top: 270px; right:30px;" hidden>
    <a id="btn_AddMeter" class="btn btn-success btn-xs " onclick="btn_AddMeter()"><i class="fa fa-plus "></i>&nbsp;添加</a>
    <a id="btn_Open2" onclick="btn_Open(2);" class="btn btn-info btn-xs "><i class="fa fa-eye "></i>&nbsp;查看</a>
    <a id="btn_DelMeter" class="btn btn-danger btn-xs " onclick="btn_DelMeter()"><i class="fa fa-trash-o "></i>&nbsp;移除</a>
</div>
<div class="toolbar CS_FX" style="position: absolute; top: 5px; right: 30px;" hidden>
    <a id="lr-addField" class="btn btn-success btn-xs " onclick="btn_add()"><i class="fa fa-plus "></i>&nbsp;添加</a>
    <a id="btn_next" onclick="btn_Open(3);" class="btn btn-info btn-xs "><i class="fa fa-eye "></i>&nbsp;查看</a>
    <a id="lr-deleteField" class="btn btn-danger btn-xs " onclick="btn_delete()"><i class="fa fa-trash-o "></i>&nbsp;移除</a>
</div>
<div class="toolbar CS_FX" style="position: absolute; top: 360px; right:30px;" hidden>
    <a id="lr-addField" class="btn btn-success btn-xs " onclick="btn_add()"><i class="fa fa-plus "></i>&nbsp;添加</a>
    <a id="btn_next" onclick="btn_Open(4);" class="btn btn-info btn-xs "><i class="fa fa-eye "></i>&nbsp;查看</a>
    <a id="lr-deleteField" class="btn btn-danger btn-xs " onclick="btn_delete()"><i class="fa fa-trash-o "></i>&nbsp;移除</a>
</div>
